import { Tag } from "antd";
import appList from "@/api/pkgs";

export const tranDeviceToTable = (envReady) => {
  const marks = {
    openssl: (
      <>
        用于制作cert.p12，这里有
        <a
          className="text-blue-600"
          href="https://www.cnblogs.com/dingshaohua/p/12271280.html"
          target="_blank"
        >
          安装教程
        </a>
      </>
    ),
    keytool: (
      <>
        基于上步，使用jdk里的keytool制作 cert.jks，这里有
        <a
          className="text-blue-600"
          href="https://www.cnblogs.com/dingshaohua/p/18285619"
          target="_blank"
        >
          安装教程
        </a>
      </>
    ),
    apksigner: (
      <>
        {" "}
        基于上步，使用andriod sdk里的apksigner做签名
        <a
          className="text-blue-600"
          href=" https://www.cnblogs.com/dingshaohua/p/18286411"
          target="_blank"
        >
          安装教程
        </a>
      </>
    ),
  };
  const res = envReady?.map((item) => ({
    ...item,
    mark: marks[item.key],
  }));
  return res;
};

export const columns = [
  {
    title: "环境",
    dataIndex: "key",
    key: "key",
  },
  {
    title: "备注",
    dataIndex: "mark",
    key: "mark",
  },
  {
    title: "状态",
    dataIndex: "status",
    key: "status",
    render: (text) =>
      text ? <Tag color="#87d068">成功</Tag> : <Tag color="#f50">失败</Tag>,
  },
];

export const appOpt = appList.map((item) => ({
  value: item.package,
  label: (
    <div className="appOpt">
      <img src={`./pkgs/${item.name}.png`} className="mr-2" />
      <div className="appOptCtx">
        <div> {item.name}</div>
        <div>{item.package}</div>
      </div>
    </div>
  ),
}));


export const signStatusDic = ['签名失败', '正在签名', '签名完成']